import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/home',
    component: () => import(/* webpackChunkName: "about" */ '../views/Home.vue'),
    children: [{
      path: '/home',
      redirect: '/home/Property'
    }, {
      path: '/home/Property',
      roles: ['管理员', '员工'],
      component: () => import(/* webpackChunkName: "Property" */ '../views/room/Property.vue')
    }, {
      path: '/home/LiveBroadcast',
      roles: ['管理员', '员工'],
      component: () => import(/* webpackChunkName: "LiveBroadcast" */ '../views/room/LiveBroadcast.vue')
    }, {
      path: '/home/GroupBuy',
      roles: ['管理员', '员工'],
      component: () => import(/* webpackChunkName: "GroupBuy" */ '../views/room/GroupBuy.vue')
    }, {
      path: '/home/Audit',
      roles: ['管理员'],
      component: () => import(/* webpackChunkName: "Audit" */'../views/room/Audit.vue')
    }, {
      path: '/home/Order',
      roles: ['管理员'],
      component: () => import(/* webpackChunkName: "Order" */'../views/room/Order.vue')
    }, {
      path: '/home/News',
      roles: ['管理员'],
      component: () => import(/* webpackChunkName: "News" */'../views/room/News.vue')
    }, {
      path: '/home/Broker',
      roles: ['管理员'],
      component: () => import(/* webpackChunkName: "Broker" */'../views/room/Broker.vue')
    }]
  }, {
    path: '/detail/:id',
    component: () => import(/* webpackChunkName: "detail" */ '../views/Detail.vue')
  }, {
    path: '/about',
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }, {
    path: '/login',
    component: () => import(/* webpackChunkName: "login" */ '../views/Login.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
